/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.jsworks.web.test.action;

import java.util.logging.Logger;
import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.ActionBeanContext;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.StreamingResolution;
import net.sourceforge.stripes.action.UrlBinding;

/**
 *
 * @author Josef Sustacek
 */
@UrlBinding("/ajaxReceive.action")
public class MenuUpdateActionBean implements ActionBean {

    private static final Logger log = Logger.getLogger(MenuUpdateActionBean.class.getName());

    private ActionBeanContext context;
    
    private String itemId;
    private int newPosition;
    private String newParentId;

    @DefaultHandler
    public Resolution updateMemu() {
        
        log.info("item with id='" + itemId + "' moved to item with id='" + newParentId +
                "' on position " + newPosition);

        return new StreamingResolution("text/plain", "Menu structure updated");
    }

    public void setContext(ActionBeanContext context) {
        this.context = context;
    }

    public ActionBeanContext getContext() {
        return context;
    }

    public String getItemId() {
        return itemId;
    }

    public void setItemId(String itemId) {
        this.itemId = itemId;
    }

    public String getNewParentId() {
        return newParentId;
    }

    public void setNewParentId(String newParentId) {
        this.newParentId = newParentId;
    }

    public int getNewPosition() {
        return newPosition;
    }

    public void setNewPosition(int newPosition) {
        this.newPosition = newPosition;
    }
}